import * as actionTypes from './actionTypes'
import axios from 'axios'
import fromJS from 'immutable'

const getSearchListAction = (data) => ({
    type: 'get_search_list',
    data: fromJS(data)
})

export const  inputFocusAction = () => ({
    type: actionTypes.INPUT_FOCUS
})

export const inputBlurAction = () => ({
    type: actionTypes.INPUT_BLUR
})

export const getSearchList = () => {
    return (dispatch) => {
        axios.get('/api/list.json').then((res)=>{
            dispatch(getSearchListAction(res.data))
        }).catch(()=>{
            console.log('请求错误！')
        })
    }
}